var ns, map, app, timer, marqueesHeight, slide, imageBrowser,
    stopscroll, scrollElem, preTop, currentTop, stoptime, leftElem, popup;
app = new Vue({
    el: '#app',
    data: {
        ID:0,
        ProjectID:0,
        list: [], 
        isviewhistory: false,
        IsChangeBt:false,//true可以转交

    },
    methods: {
        get_data: function() {
            var that = this;
            var options = {};
            options.ID = that.ID;
            options.action = "getcheckplandetail";
            ns.post(options, function (succeed, data, err) {
                if (succeed) {
                    that.list = data.data;
                    that.IsChangeBt=data.IsChangeBt;

                } else if (err) {
                    api.toast({
                        msg: err,
                        duration: 2000,
                        location: 'bottom'
                    });
                }
                setTimeout(()=>{
                    api.sendEvent({
                        name:'is_hidden_right_quality_checklist',
                        extra: {
                            keyId: "right_qualityrenwu",
                            IsHidden: that.IsChangeBt
                        }
                    })
                },500)

            }, {
                toast: true
            });
        },
        //检查记录
        do_jiancha:function(CheckProjectScore,DeductScore,item){
            var that=this;
            if(item.IsComplete==1){
                ns.openWin('qualitykaohe_result', '考核结果',{
                    ID:item.ID
                })
            }else{
                ns.openWin('qualitykaohe', '考核记录',{
                    CheckProjectScore:CheckProjectScore,
                    DeductScore:DeductScore,
                    item:item,
                    IsChangeBt:that.IsChangeBt,
                })
            }
            
        },
    }
});
apiready = function() {
    api.parseTapmode();
    ns = window.Foresight.Util;
    app.ID = api.pageParam.ID||0;
    app.ProjectID = api.pageParam.ProjectID||0,
    app.get_data();
    api.addEventListener({
        name: 'reloadservicelist'
    }, function(ret, err) {
        app.get_data();
    });
    // api.addEventListener({
    //     name: 'do_openquality'
    // }, function(ret, err) {
    //     ns.openWin('qualitycontrol_frm','新增整改工单',{
    //         RelatedID:ret.value.RelatedID,
    //         ComeFrom:ret.value.ComeFrom
    //     });
    // });
    api.addEventListener({
        name: 'close_window'
    }, function(ret, err) {
        api.closeWin()
    });

    api.addEventListener({
        name: 'do_qualityzhuanjiao'
    }, function (ret, err) {
        ns.openWin('quality_chooseperson','选择转交人',{
            id:app.ID,
            ProjectID:app.ProjectID,
            type:3,
        });
    });

};
